package com.ubao.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;

import com.ubao.R;
import com.ubao.activity.MyApp;

public class ExitDialog {
	private MyApp global;
	private Activity mContext;

	public ExitDialog(MyApp app, Activity context) {
		global = app;
		mContext = context;
	}

	public void show() {
			new AlertDialog.Builder(mContext)
					.setIcon(
							mContext.getResources().getDrawable(
									android.R.drawable.ic_dialog_alert))
					.setTitle("您确认要退出系统？")
					.setPositiveButton("确定",
							new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dlg,
										int sumthin) {
//									FeedBackManager feedBackManager = new FeedBackManager();
//									new Thread(
//											feedBackManager.new CloseFeedBackThread(
//													mContext)).start();

									// unregisterReceiver(mReceiver2);
//									MyApp.hasInitNetWork = false;
									// HttpClient.FirstLogin = true;
//									MyApp.needLoop = false;

//									MyApp.isFirstRun = true;

//									MyApp.NeedResume = false;
//									ScreenReceiver.bScreenOf_NetOn = false;
//									MyApp.isNeedWrite = true;
									// MyApp.mPassLoginSuccess = false;
//									global.setFromWidget(false);

									MyApp.getMyApp().exitClient();
									// MyApp.SyncFlagDismiss[0] =
									// MyApp.SyncFlagDismiss[1] =
									// MyApp.SyncFlagDismiss[2] = false;
									// TradeManager.getInstance().destroy();
									// StockSyncManager.getInstance().stop();
									mContext.finish();
									// System.exit(0);

								}
							})
					.setNegativeButton("取消",
							new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dlg,
										int sumthin) {

								}
							}).show();
		}
}
